using System;
using System.ComponentModel;
using System.Xml.Serialization;

namespace Core.GameObjects.Stats
{
    public enum StatType
    {
        Regular,
        Calculated
    }

    public enum DieType
    {
        d2 = 2,
        d4 = 4,
        d6 = 6,
        d8 = 8,
        d10 = 10,
        d12 = 12,
        d20 = 20,
        d100 = 100,
        MaxDie = 100
    }

    /// <summary>A Stat, used for an Entity.</summary>
    [XmlRoot()]
    [DefaultProperty("Stat")]
    public class Stat
    {        
        /// <summary>Stat ID</summary>
        public int ID { get { return _ID;}  set { _ID = value; } }
        /// <summary>Type of Stat</summary>
        public StatType Type { get { return _Type; } set { _Type = value; } }
        /// <summary>Name of Stat</summary>
        public string Name { get { return _Name; } set { if (value.Length > 0) _Name = value; } }
        /// <summary>Stat Abbreviation</summary>
        public string Abbreviation { get { return _Abbreviation; } set { if (value.Length > 0) _Abbreviation = value; } }
        /// <summary>Stat Description</summary>
        public string Description { get { return _Description; } set { if (value.Length > 0) _Description = value; } }
        /// <summary>Stat Calculation, for Calculated Stats</summary>
        public string StatCalculation { get { return _StatCalculation; } set { _StatCalculation = value; } }
        /// <summary>Does Stat Add to Skill Points</summary>
        public bool AddsToSkillPoints { get { return _AddsToSkillPoints; } set { _AddsToSkillPoints = value; } }
        /// <summary>Does Stat Add to Nen Points</summary>
        public bool AddsToNenPoints { get { return _AddsToNenPoints; } set { _AddsToNenPoints = value; } }

        private int _ID = 0;
        private StatType _Type = StatType.Regular;
        private string _Name = "";
        private string _Abbreviation = "";
        private string _Description = "";
        private string _StatCalculation = ""; //Doing Calculated Stats should be scripted.  Will add script object later

        private bool _AddsToSkillPoints = false;
        private bool _AddsToNenPoints = false;

        public const Int16 MAX_STAT_VALUE = (Int16)DieType.MaxDie;

        public Stat(string StatName)
        {
            _Name = StatName;
        }

        public override string ToString()
        {
            return _Name + "(" + _Abbreviation + ")";
        }
    }
}
